import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HotelOrdersVO, HotelOrdersForm, HotelOrdersQuery } from '@/api/hotel/hotelOrders/types';

/**
 * 查询酒店订单列表
 * @param query
 * @returns {*}
 */

export const listHotelOrders = (query?: HotelOrdersQuery): AxiosPromise<HotelOrdersVO[]> => {
  return request({
    url: '/hotel/hotelOrders/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询酒店订单详细
 * @param id
 */
export const getHotelOrders = (id: string | number): AxiosPromise<HotelOrdersVO> => {
  return request({
    url: '/hotel/hotelOrders/' + id,
    method: 'get'
  });
};

/**
 * 新增酒店订单
 * @param data
 */
export const addHotelOrders = (data: HotelOrdersForm) => {
  return request({
    url: '/hotel/hotelOrders',
    method: 'post',
    data: data
  });
};

/**
 * 修改酒店订单
 * @param data
 */
export const updateHotelOrders = (data: HotelOrdersForm) => {
  return request({
    url: '/hotel/hotelOrders',
    method: 'put',
    data: data
  });
};

/**
 * 删除酒店订单
 * @param id
 */
export const delHotelOrders = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hotel/hotelOrders/' + id,
    method: 'delete'
  });
};

export const orderRefund = (data: HotelOrdersForm) => {
  return request({
    url: '/hotel/hotelOrders/wechat/refund',
    method: 'post',
    data: data
  });
};
